import 'package:flutter/cupertino.dart';

///把子view变成可局部刷新的view，需要调用[UpdateViewState]的[update]方法手动刷新子view
class UpdateView extends StatefulWidget {
  final Widget Function(UpdateViewState state) build;

  const UpdateView({super.key, required this.build});

  @override
  State<StatefulWidget> createState() => UpdateViewState();
}

class UpdateViewState extends State<UpdateView> {
  update() {
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return widget.build.call(this);
  }
}
